@{
    ViewBag.Title = "Home";
    Layout = "/Views/Shared/_Layout.cshtml";
}
@using Kaiser.Cubic.Service
@using Kaiser.Extensions;
@{
    var service = new CubicServiceClient();
    var about = service.GetNewsByCode("About") ?? new NewsDetail();
    //var WhyUs = service.GetNewsByCode("WhyUs");
    var qualityControl = service.GetNewsByCode("QualityControl") ?? new NewsDetail();
    var productBanner = service.GetAdvertSpaceByCode("HomeProductBanner") ?? new AdvertSpace();

    var newsCategory = service.GetNewsCategoryByCode("EnglishNews");
    var news = service.GetNewsByCategoryId(newsCategory.Id.ToString());
}

<div class="index_center">
    <div class="bg"></div>
    <div class="conBg">
        @RenderPage("/Views/Shared/Menu.cshtml")
        @RenderPage("/Views/Shared/Banner.cshtml")
        <div class="con">
            <div class="left">
                <div class="erLeftTitle">Products</div>
                @Html.Action("ProductTreeMenu", "Home")

            </div>
            <div class="right">
                <div class="right_1">
                    <div class="right_1_a">
                        News
                    </div>
                    <div id="news" class="right_1_b">
                        @for (var i = 0; i < news.Count(); i++)
                        {
                            var item = news[i];
                            if (i == 0)
                            {
                            <a select="true" href="/china/News/NewsDetail.html?id=@item.Id">
                                @item.TitleShort
                            </a>
                            }
                            else
                            {
                            <a style="display: none" href="/china/News/NewsDetail.html?id=@item.Id">
                                @item.TitleShort
                            </a>
                               
                            }

                        }


                    </div>
                    <div class="right_1_c">
                        <img id="preNewsBtn" style="cursor:pointer" src="/images/index_51.png" />&nbsp;&nbsp;&nbsp;<img id="nextNewsBtn"  style="cursor:pointer" src="/images/index_53.png" />
                    </div>
                </div>
                <div class="right_2">
                    <div class="right_2_title">
                        About Cubic
                    </div>
                    <div class="right_2_border">
                        <div class="right_2_a">
                            <img src="/images/index_64.jpg" />
                        </div>
                        <div class="right_2_b">

                            @(new HtmlString(about.ContentSummary))

                        </div>
                        <div class="right_2_c">
                            <a href="@Url.Action("About")" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image22','','/images/inde_12.png',1)">
                                <img src="/images/index_67.png" name="Image22" width="57" height="21" border="0" id="Image22" /></a>
                        </div>
                    </div>
                </div>
                <div class="right_3">

                    @foreach (var item in productBanner.AdvertDetail)
                    {
                        <a href="@item.Link">
                            <img width="204" height="203" src="@item.Affix" /></a><span></span>
                    }



                </div>
                <div class="right_4">
                    <div class="right_5">
                        <div class="right_5_title">
                            Quality Control
                        </div>
                        <div class="right_5_border">
                            <div class="right_5_a">


                                @(new HtmlString(System.Web.HttpContext.Current.Server.UrlDecode(qualityControl.ContentSummary ?? string.Empty) ?? string.Empty.CleanHtmlTags().Substr(300)))

                            </div>
                            <div class="right_5_b">
                                <a href="@Url.Action("NewsDetail", "News", new { area = "China" })?id=@qualityControl.Id" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image27','','/images/inde_12.png',1)">
                                    <img src="/images/index_67.png" name="Image27" width="57" height="21" border="0" id="Image27" /></a>
                            </div>
                        </div>
                    </div>
                    <div class="video">
                        <div class="video_1">
                            Video
                        </div>
                        <div class="video_2">
                            <a href="@Url.Action("Video", "Home", new { area = "China" })">
                                <img id="imgHref" src="/images/index_85.jpg" style="width: 100%; height: 100%" /></a>
                            @* <object id="videowindow1" width="100%" height="100%" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6">
                                <param name="URL" value="http://hc.yinyuetai.com/uploads/videos/common/39BE013BAECFA7E08E73EA2120EE81D5.flv?sc=16e795f7577cc6ad&br=779&ptp=mv&rd=so.yinyuetai.com====filesize:25284643====duration:259">
                                <param name="AUTOSTART" value="0">
                            </object>*@
                        </div>
                    </div>
                </div>
            </div>
        </div>
        @RenderPage("/Views/Shared/Foot.cshtml")
        <script src="/Scripts/chatJs/chat.2012.js"
            type="text/javascript"></script>
    </div>
</div>

<script>
    $(function () {
        $("#nextNewsBtn").click(function () {
        
            $("#news a[select='true']").each(function () {
           
                var next = $(this).next();
             
                next.siblings().hide().removeAttr('select');
                next.attr('select', 'true');
                next.show();
            });
        });
        
        $("#preNewsBtn").click(function () {

            $("#news a[select='true']").each(function () {

                var prev = $(this).prev();
               
                prev.siblings().hide().removeAttr('select');
                prev.attr('select', 'true');
                prev.show();
            });
        });
     
    });
</script>



